<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Every thing with my lover, Lijun.">
    <meta name="author" content="zxy_ankh">
    <title>和李君小可爱的一切</title>
    <link rel="icon" href="favicon.ico">
    <embed src="ValderFields.mp3" loop="true" hidden="true" width="0" height="0"/>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
    <script src="js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            setInterval(function () {
                $.get({
                    url: "time",
                    success: function (data) {
                        var $time_tbody = $('#time_tbody');
                        $time_tbody.empty();
                        $time_tbody.append('<tr>\n' +
                            '<td>何时认识</td>\n' +
                            '<td id="meetTime">2018年9月26日15点57分</td>\n' +
                            '</tr>\n' +
                            '<tr>\n' +
                            '<td>认识多久</td>\n' +
                            '<td id="totalMeetTime">' + data['totalMeetDay'] + "天"
                            + data['totalMeetHour'] + "分" + data['totalMeetMinute'] + "秒" + '</td>\n' +
                            '</tr>\n' +
                            '<tr>\n' +
                            '<td>何时在一起</td>\n' +
                            '<td id="loveTime">2018年10月15日14点14分</td>\n' +
                            '</tr>\n' +
                            '<tr>\n' +
                            '<td>在一起多久</td>\n' +
                            '<td id="totalLoveTime">' + data['totalLoveDay'] + "天"
                            + data['totalLoveHour'] + "分" + data['totalLoveMinute'] + "秒" + '</td>\n' +
                            '</tr>')
                    }
                })
            }, 2000);
        });

        function showPhoto() {
            $('#memory_li').removeClass();
            $('#photo_li').addClass('active');
            $('#memory_container').hide();
            $('#photo_container').show();
        }

        function showMemory() {
            $('#memory_li').addClass('active');
            $('#photo_li').removeClass();
            $('#memory_container').show();
            $('#photo_container').hide();
            $.get({
                url: "display",
                success: function (data) {
                    var $things_container = $('#things_container');
                    for (var i in data.moments) {
                        $things_container.append('<br>' + data.moments[i]);
                    }
                }
            });
        }
    </script>
</head>
<body onload="showMemory()">

<!-- Static navbar -->
<nav class="navbar navbar-default navbar-static-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">和李君小可爱的一切</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li id="memory_li" class="active"><a href="#" onclick="showMemory()">记录</a></li>
                <li id="photo_li"><a href="#" onclick="showPhoto()">照片</a></li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>

<div class="leftContainer">
    <div class="col-lg-3">
        <table border="0" class="table">
            <tbody id="time_tbody">
            <tr>
                <td>何时认识</td>
                <td id="meetTime">2018年9月26日15点57分</td>
            </tr>
            <tr>
                <td>认识多久</td>
                <td id="totalMeetTime"></td>
            </tr>
            <tr>
                <td>何时在一起</td>
                <td id="loveTime">2018年10月15日14点14分</td>
            </tr>
            <tr>
                <td>在一起多久</td>
                <td id="totalLoveTime"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>


<div class="container" id="memory_container">
    <div>
        <label>发生了什么</label>
        <br/>
        <div id="things_container" class="container">

        </div>
    </div>
</div><!-- /.container -->

<div class="container" id="photo_container" hidden>
    <div id="myCarousel" class="carousel slide">
        <!-- 轮播（Carousel）指标 -->
        <ol id="photo_ol" class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
            <li data-target="#myCarousel" data-slide-to="3"></li>
            <li data-target="#myCarousel" data-slide-to="4"></li>
            <li data-target="#myCarousel" data-slide-to="5"></li>
            <li data-target="#myCarousel" data-slide-to="6"></li>
            <li data-target="#myCarousel" data-slide-to="7"></li>
            <li data-target="#myCarousel" data-slide-to="8"></li>
        </ol>
        <!-- 轮播（Carousel）项目 -->
        <div id="photos" class="carousel-inner">
            <div class="item active">
                <img alt src="img/IMG_1080.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1082.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1085.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1086.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1093.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1094.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1105.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1109.JPG">
            </div>
            <div class="item">
                <img alt src="img/IMG_1114.JPG">
            </div>
        </div>
        <!-- 轮播（Carousel）导航 -->
        <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
</div><!-- /.container -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>